<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
    <!--<script src="js/jquery.min.js"></script>-->
    <script src="../static/vue.js"></script>
    <script src="../static/axios.js"></script>
    <script src="../static/util.js"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
    <div id="app">
    
        <el-form :model="pojo" label-width="100px" class="demo-ruleForm">
            <el-form-item label="姓名" prop="name">
                <el-input  v-model="pojo.name" style="width: 350px;"></el-input>
              </el-form-item>
            <el-form-item label="用户名" prop="username">
                <el-input  v-model="pojo.userName" style="width: 350px;"></el-input>
              </el-form-item>
              <el-form-item label="密码" prop="password">
                <el-input  v-model="pojo.password" show-password style="width: 350px;"></el-input>
              </el-form-item>
              <el-form-item label="年龄" prop="age">
                <el-input  v-model="pojo.age" style="width: 350px;"></el-input>
              </el-form-item>
        
                <el-form-item label="创建时间" prop="createTime">
                    <el-date-picker v-model="pojo.createTime"  type="date" placeholder="选择日期"  style="width: 350px;"></el-date-picker>
                </el-form-item>
        <el-button type="primary" @click="save()">保存</el-button>

        </el-form>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                pojo: {}
            },
            created(){
                this.findById()
            },
            methods:{
                findById(){
                    axios.get("http://localhost:8888/emp/findById?id="+getQueryString("id")).then(res=>{
                        this.pojo=res.data.data;
                    })
                },
                save(){
                    axios.post("http://localhost:8888/emp/edit",this.pojo).then(res=>{
                        alert("修改成功")
                        location.href="findPage.html"
                    })
                }
            }
        })
    </script>
</body>
</html>